package com.moji.controller.api;


import com.moji.common.base.ApiResult;
import com.moji.entity.MjAboutUs;
import com.moji.entity.MjFlow;
import com.moji.entity.dto.QueryFlowDto;
import com.moji.entity.vo.MjFlowVo;
import com.moji.service.MjFlowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 流程配置表 前端控制器
 * </p>
 *
 * @author ccl
 * @since 2024-07-27
 */
@RestController
@RequestMapping("/api/mjFlow")
@Api(tags = "审批流程", value = "审批流程api相关接口")
public class MjFlowController {

    @Resource
    private MjFlowService mjFlowService;

    @PostMapping("/queryByPage")
    @ApiOperation(value = "审批流程_分页查询",response = MjFlow.class)
    public ApiResult queryByPage(@RequestBody QueryFlowDto dto){
        return ApiResult.ok(mjFlowService.queryByPage(dto));
    }

    @GetMapping("/detail")
    @ApiOperation(value = "审批流程_详情",response = MjFlowVo.class)
    public ApiResult detail(Long id){
        return ApiResult.ok(mjFlowService.detail(id));
    }

    @GetMapping("/audit")
    @ApiOperation(value = "审核通过",response = Boolean.class)
    public ApiResult audit(@RequestParam("id") Long id){
        return ApiResult.ok(mjFlowService.audit(id));
    }

    @GetMapping("/refuse")
    @ApiOperation(value = "审核驳回",response = Boolean.class)
    public ApiResult refuse(@RequestParam("id") Long id,@RequestParam("reason") String reason){
        return ApiResult.ok(mjFlowService.refuse(id,reason));
    }

    @GetMapping("/delete")
    @ApiOperation(value = "流程_删除",response = Boolean.class)
    public ApiResult delete(@RequestParam("id") Long id){
        return ApiResult.ok(mjFlowService.delete(id));
    }


}

